#include "MultiArray.cpp"

#define UNIFORM_KNOT 1

#define DIM 2

class PP
{
public:
	PP(void);
	~PP(void);


#if	UNIFORM_KNOT	
#else
	MultiArr<float>* knot;
#endif

	void SolveEquations(int* RootNum, float* RootXYZ);
	void SolveEquationsIter(float Interval[DIM][2], MultiArr<float>* Coeff, int* RootNum, float* RootXYZ);
	void SolveEquationsNoIter(float Interval[DIM][2], MultiArr<float>* Coeff, int* RootNum, float* RootXYZ);

	void SetEquationCoeff(int nEqua, int* nDeg, int maxDeg[DIM], float* weight);

	bool GetProjectedIntevalIntersection(MultiArr<float>* Coeff, float Interval[DIM][2], float AxisInterval[DIM][2]);
	bool AxisIntersection(float* convex, float intersect[2], int deg);

	void ShrinkInterval(float subdivisionInterval[DIM][2], MultiArr<float>* weight);

	bool RootRefine(float* root);
	void RootCluster(float* root, int* RootNum, float* RootXYZ);

	
protected:
private:
	int nEquation;
	int* nDegXYZ;
	int nMaxDeg[DIM];
	int nMaxXYZDeg;
	MultiArr<float>* coeff;
};